package com.example.demo01.Service.mobileService;

import com.example.demo01.Dao.mobileDao.ServiceOrderDao;
import com.example.demo01.Entity.mobileEntity.ServiceOrder;
import com.example.demo01.Entity.mobileEntity.ServiceOrderSolved;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ServiceOrderService {
    @Autowired
    private ServiceOrderDao serviceOrderDao;

    /**
     * 插入一条数据
     */
    public int insert(ServiceOrder serviceOrder) { return serviceOrderDao.insert(serviceOrder); }

    /**
     * 获取所有服务订单数据
     * @return
     */
    public List<ServiceOrder> selectAll(String username) { return serviceOrderDao.selectAll(username); }

    /**
     * 获取所有详细订单数据
     * */
    public List<ServiceOrderSolved> selectAllDetailByPageSize(Integer beginIndex,Integer offSize) { return serviceOrderDao.selectAllDetailByPageSize(beginIndex, offSize); }

    /**
     * 获取详细订单数据——带id值的未处理订单
     * */
    public List<ServiceOrder> selectAllWidthoutDeal(Integer beginIndex,Integer offSize) {return serviceOrderDao.selectAllWidthoutDeal(beginIndex, offSize); }

    /**
     * 获取分页的总页数
     * @return
     */
    public int getTotalSize(Integer pageSize) { return serviceOrderDao.getTotalSize(pageSize); }

    /**
     * 获取未处理的消息的总页数
     * @param pageSize
     * @return
     */
    public int getTotalSizeOfUnSolved(Integer pageSize) { return serviceOrderDao.getTotalSizeOfUnSolved(pageSize); }

    /**
     * 更新服务消息记录
     */
    public int updateServiceRecord(String clientusername,String lon,String lat,String ordertime,String admin,String status)
    { return serviceOrderDao.updateServiceRecord(clientusername, lon, lat, ordertime,admin,status); }
}
